class DevTools {
  constructor() {
    this.init();
  }
  init() {
    this.listenToMessage();
  }

  openDevTools(tabId?:number) {
    if(!tabId) {
        return;
      }
  
      chrome.runtime.sendMessage({ action: "openDevTools", tabId: tabId });
  }

  listenToMessage() {
    chrome.runtime.onMessage.addListener((req, sender, sendResp) => {
    console.log("[CONTENT SCRIPT] 收到消息:",req);

      if (req.action === "openDevTools") {
        sendResp({ action: "openDevTools" });
      }
      return true
    });
  }
}

new DevTools();